package com.weishi.project.speedometer.vo;

import com.weishi.common.utils.DateUtils;
import lombok.Data;

@Data
public class MantianxingGpsVo {

    private String deviceId;
    private String localTime;
    private long timeTimp;
    private double b;
    private double l;
    private double h;
    private double speed;
    private double speedTodistance;//根据距离计算的速度
    private double distance;
    private double distanceTotal;

    private double hrms;//垂直中误差
    private double xrms;//水平中误差
    private double yrms;//竖直中误差
    private int solutionUsedSats;//解算使用的卫星数
    private int quality;//GPS质量

    public static MantianxingGpsVo changeVo(String xml){
        MantianxingGpsVo vo = new MantianxingGpsVo();
        String[] aa = xml.split(">");
        String deviceId = aa[5].split("<")[0];
        vo.setDeviceId(deviceId);
        String localTime = aa[7].split("<")[0];
        vo.setTimeTimp(DateUtils.getLongTime(localTime));
        vo.setLocalTime(localTime.split(" ")[1]);
        double b = Double.parseDouble(aa[11].split("<")[0]);
        vo.setB(b);
        double l = Double.parseDouble(aa[13].split("<")[0]);
        vo.setL(l);
        double h = Double.parseDouble(aa[15].split("<")[0]);
        vo.setH(h);
        double speed= Double.parseDouble(aa[19].split("<")[0]);
        vo.setSpeed(speed);
        return vo;
    }

}
